package com.ruicar.afs.cloud.apply.admin.api.feign;

import com.ruicar.afs.cloud.common.core.util.IResponse;
import com.ruicar.afs.cloud.common.modules.apply.dto.ChannelAuthRegionDTO;
import com.ruicar.afs.cloud.common.modules.apply.dto.ChannelBasicInfoDTO;
import com.ruicar.afs.cloud.common.modules.apply.dto.ChannelCardDTO;
import com.ruicar.afs.cloud.common.modules.apply.dto.WitnessInfoDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author: Lee
 * @date: 2020/5/11 19:39
 * @description: 渠道上线成功数据同步
 */
@FeignClient(name = "applyAdmin", url = "${com.greatwall.services.wow-admin.url}")
public interface ChannelOnlineSyncService {

    /**
     * 同步渠道授权区域信息
     */
    @ApiOperation("同步渠道授权区域信息")
    @PostMapping(value = "applyAuth/syncAuthRegion")
    IResponse syncAuthRegion(@RequestBody ChannelAuthRegionDTO channelAuthRegion, @RequestHeader Map<String, String> headers);

    /**
     * 同步渠道授权区域信息
     */
    @ApiOperation("初始化创建用户")
    @PostMapping(value = "applyAuth/createUser")
    IResponse createUser(@RequestBody ChannelBasicInfoDTO channelBasicInfo, @RequestHeader Map<String, String> headers);

    /**
     * 同步见证人信息
     */
    @ApiOperation("同步见证人信息")
    @PostMapping(value = "applyAuth/syncWitnessInfo")
    IResponse syncWitnessInfo(@RequestBody List<WitnessInfoDTO> witnessInfos, @RequestHeader Map<String, String> headers);

    /**
     * 停用见证人
     *
     * @param List<String> card 见证人的身份证号码
     */
    @ApiOperation("停用见证人")
    @PostMapping(value = "applyAuth/stopWitnessInfo")
    IResponse stopWitnessInfo(@RequestBody List<ChannelCardDTO> cards, @RequestHeader Map<String, String> headers);

    @ApiOperation("停用见证人因为黑名单")
    @PostMapping(value = "applyAuth/stopWitnessByBlack")
    IResponse stopWitnessByBlack(@RequestBody List<ChannelCardDTO> cards, @RequestHeader Map<String, String> headers);

    /**
     * 启用见证人
     *
     * @param List<String> card 见证人的身份证号码
     */
    @ApiOperation("启用见证人")
    @PostMapping(value = "applyAuth/startWitnessInfo")
    IResponse startWitnessInfo(@RequestBody List<ChannelCardDTO> cards, @RequestHeader Map<String, String> headers);

    /**
     * 根据身份证号码查询见证人角色
     *
     * @param List<String> card 见证人的身份证号码
     */
    @ApiOperation("根据身份证号码查询见证人角色")
    @PostMapping(value = "applyAuth/findWitnessRole")
    IResponse findWitnessRole(@RequestBody List<ChannelCardDTO> cards, @RequestHeader Map<String, String> headers);

    /**
     * 根据parentId获取部门树
     *
     * @param String parentId 部门的parentId
     */
    @ApiOperation("根据parentId获取部门树")
    @PostMapping(value = "applyAuth/findDeptByParentId")
    IResponse findDeptByParentId(@RequestParam("parentId") String parentId, @RequestParam("channelId") String channelId, @RequestHeader Map<String, String> headers);

    /**
     * 根据parentId获取部门树
     *
     * @param String deptId 部门的deptId
     * @param String channelId 渠道的channelId
     */
    @ApiOperation("根据parentId获取部门树")
    @PostMapping(value = "applyAuth/getDeptAuthRegion")
    IResponse getDeptAuthRegion(@RequestParam("channelId") String channelId, @RequestParam("deptId") String deptId, @RequestHeader Map<String, String> headers);

    /**
     * 根据部门id获取用户
     *
     * @param Long deptId 部门id
     */
    @ApiOperation("根据部门id获取用户")
    @PostMapping(value = "applyAuth/findUserByDeptId")
    IResponse findUserByDeptId(@RequestBody Long deptId, @RequestHeader Map<String, String> headers);

    @ApiOperation("停用合作商以及合作商下面的用户")
    @PostMapping(value = "applyAuth/stopChannel")
    IResponse stopChannel(@RequestBody List<Long> cards, @RequestHeader Map<String, String> headers);

    @ApiOperation("校验见证人")
    @PostMapping(value = "applyAuth/checkWitness")
    IResponse checkWitness(@RequestBody List<ChannelCardDTO> cards, @RequestHeader Map<String, String> headers);

}
